package com.shi;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

@SpringBootApplication
public class ShiBackApplication {

    public static void main(String[] args) {
        SpringApplication.run(ShiBackApplication.class, args);
    }

    /*@Override
    public void onStartup(javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException {
        String contextPath = "/myapp";
        WebApplicationContext webApplicationContext = createRootApplicationContext(servletContext);
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, webApplicationContext);
        servletContext.addServlet("dispatcher", new DispatcherServlet(webApplicationContext)).addMapping(contextPath + "/*");
    }

    private WebApplicationContext createRootApplicationContext(javax.servlet.ServletContext servletContext) {
        AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext();
        context.setServletContext(servletContext);
        // 配置其他的Bean和组件
        return context;
    }*/

}
